 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 订单管理</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">

</head>
<style>
#listtable .fa{
	cursor:pointer;
	color:#1ab394;
	margin-right:1em;
}
th .tag{font-size: 12px; color: #e66c6c; font-weight: normal;}
.ibox-title .tag{font-size: 12px; color: #e66c6c; font-weight: normal; display: inline-block; margin-left: 20px;}
.specval-hide{display: none;}

.btn-group{ font-size:0}
.btn-group .btn{ margin-left:-1px}
.btn-group .btn:not(:first-child):not(:last-child):not(.dropdown-toggle){ border-radius:0}
.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius: 0;border-top-right-radius: 0}
.btn-group > .btn:last-child:not(:first-child),.btn-group > .dropdown-toggle:not(:first-child) {border-bottom-left-radius: 0;border-top-left-radius: 0}

</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
					<div class="ibox-title">
                        <h5>订单信息</h5>
                    </div>
                    <div class="ibox-content">
						<table class="table table-bordered" id="listtable">
							<thead>
								<tr>
									<th width="">订单号</th>
									<th width="">买家姓名</th>
									<th width="">联系电话</th>
									<th width="">下单时间</th>
									<th width="">支付金额</th>
									<!-- <th width="">退款金额 <span class="text-danger">(双击修改)</span></th> -->
								</tr>
							</thead>
							<tbody>
								<tr class="goodsname" data-order_id="{$order_id}">
									<td>{$order_no}</td>
									<td>{$receiver_name}</td>
									<td>{$receiver_mobile}</td>
									<td>{$create_time}</td>
									<td>{$pay_money}</td>
									<!-- <td class="editable">{$refund_money}</td> -->
								</tr>
							</tbody>
						</table>
                    </div>
                </div>
            </div>
        </div>
		<div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
					<div class="ibox-title">
                        <h5>订单商品列表</h5>
                    </div>
                    <div class="ibox-content">
						<form id="myForm">
							<table class="table table-striped">
								<thead>
									<tr>
										<!-- <th><input name="checkall" type="checkbox" class="i-checks" value="1"></th> -->
										<th>商品图片</th>
										<th>商品名</th>
										<th>规格名</th>
										<th>商品价格</th>
										<th>商品数量</th>
										<th>退货数量</th>
										<th>退货原因</th>
									</tr>
								</thead>	
								<tbody>
									{volist name="order_goods" id="vo"}
										<tr>
											<!-- <td></td> -->
											<td><input name="ids[]" type="hidden" value="{$vo.order_goods_id}"><img src="{$vo.goods_picture}" width="30" height="30"/></td>
											<td>{$vo.goods_name}</td>
											<td>{$vo.goods_specval_name}</td>
											<td>{$vo.price}</td>
											<td>{$vo.num}</td>
											<td width="150">
												<div class="input-group">
													<input type="text" class="form-control good_num" name="nums[]">
													<!-- <span class="input-group-addon sub">-</span> -->
												</div>
											</td>
											<td>
												<textarea class="form-control m-b" placeholder="请填写退货原因...." name="remark[]"></textarea>
											</td>
										</tr>
									{/volist}
								</tbody>
							</table>
							<input type="hidden" name="order_status" value="{$order_status}" />
							<input type="hidden" name="order_id" value="{$order_id}" />
							<input type="submit" class="btn btn-primary" value="确定" />
						</form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/jedit.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/jquery.jeditable.js"></script>
</body>

</html>
<script>
$(document).ready(function() {
	$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",});

	//全选
	$("input[name='checkall']").on("ifChecked",function(){
		$("input[name='ids[]']").iCheck("check");
	});
	//取消全选
	$("input[name='checkall']").on("ifUnchecked",function(){
		$("input[name='ids[]']").iCheck("uncheck");
	});
	//退款金额	
	$('.editable').editable('{:url("refund")}',{
			type:'text',//实时编辑input框的type
			indicator:'保存中...',//提交处理过程中显示的提示文字
			tooltip:'双击编辑...',//鼠标悬停时的提示信息
			event:'dblclick',  //触发事件
			method:'post',  //提交类型
			width:'100',  //input宽度
			name:'refund_money',  //input的name属性
			submitdata:function(value, settings){
				var order_id = $(this).closest('tr').data('order_id');
				return {order_id : order_id};
			},
			onblur:'submit',  //失去焦点触发事件
			callback:function(value, settings){  //回调函数,$(this)表示当前修改input框
				$(this).text(JSON.parse(value)); 
			}
		});	
		
	$('#myForm').on('submit',function(){
		majax('{:url("refund")}',$(this).serialize(),function(d){
			if (d.code>0) {
				window.parent.editSuccess(d);
			}else{
				layer.msg(d.msg, {icon: 5});
			}
		});
		return false;
	});	
	
	//减数量
	$(document).on('click','.sub',function(){
		var good_num = $(this).closest('td').find('.good_num').val();
		if(good_num > 0){
			good_num--;
			$(this).closest('td').find('.good_num').val(good_num);
		}else{
			$(this).closest('td').find('.good_num').val(0);
			layer.msg('不能再减啦!!',{icon : 0});
		}
	});
});	
</script>